import GameData from "./GameData";
import vv from "./vv";
import v from "./v";

// Learn TypeScript:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/typescript.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    onCollisionEnter(other, self)
    {
        let luogang = 
            {
                "luogang":"哈哈",
                "luogang1":"哈哈",
                "luogang2":"哈哈",
                "luogang3":"哈哈",
                "luogang4":"哈哈",
                "luogang5":"哈哈"
            }
        if(GameData.Instance.shaichevoiceOnOrOff == true)
        {
            cc.find('Canvas/AudioManager').children[7].getComponent(cc.AudioSource).play()
        }
        var finished = cc.callFunc(function () {
           this.node.active = false
        }, this);
        let jinbikuang:cc.Node = cc.find('Canvas/金币框')
        let action1 = cc.moveTo(0.3,this.node.position.x-150,this.node.position.y+1000)
        let action = cc.sequence(action1,finished)
        this.node.runAction(action)
        v.emit('chijinbi')
        //this.node.active = false
        GameData.Instance.goldNum+=10
        v.emit('goldchange')
    }

    start () {

    }

    // update (dt) {}
}
